#ifndef __H_SINGLETON_H__
#define __H_SINGLETON_H__


template <class T>
class Singleton {
private:
    static T & get_instance() {
        static T t;
        return static_cast<T &>(t);
    }
protected:
    Singleton(){}

public:
    static T & get_mutable_instance(){
        return get_instance();
    }
    static const T & get_const_instance(){
        return get_instance();
    }
};

#define INST(T) Singleton<T>::get_mutable_instance()
#define INST_C(T) Singleton<T>::get_const_instance()

#endif
